package com.cskaoyan.controller.front.feedback;


import com.cskaoyan.bean.bo.front.feedback.FeedbackBo;
import com.cskaoyan.bean.po.BaseParam;
import com.cskaoyan.bean.vo.back.BaseRespVo;
import com.cskaoyan.mapper.MarketFeedbackMapper;
import com.cskaoyan.service.front.feedback.FeedbackService;
import com.cskaoyan.util.MobileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("wx")
public class FeedbackController {

    @Autowired
    FeedbackService feedbackService;

//    通过FeedbackBo接收submit
    @PostMapping("feedback/submit")
    public BaseRespVo submit(@RequestBody FeedbackBo feedbackBo) {
        String mobile = feedbackBo.getMobile();
        if(!MobileUtil.isMobile(mobile)){
            return BaseRespVo.isParameter("参数不对");
        }
        feedbackService.createFeedback(feedbackBo);

        return BaseRespVo.ok();
    }
}
